import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { uniqueId } from 'lodash';

@Component({
  selector: 'app-header-grouping-scrolling',
  templateUrl: './header-grouping-scrolling.component.html',
  styles: [
    `
      .aui-help-tips {
        margin-top: 16px;
      }
    `,
  ],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HeaderGroupingScrollingComponent implements OnInit {
  data;
  selection: [];

  ngOnInit() {
    this.initData();
  }

  initData() {
    this.data = Array.from({ length: 5 }).map((item, key) => this.initUser(key));
  }

  initUser(key: number) {
    return { id: uniqueId('uid'), name: `this is long long long name of user${key}`, age: 10 + key, expand: false, number: `001100${key}` };
  }

  checkAllChange(source) {
    console.log('check all:', source);
  }

  selectionChange(source) {
    console.log('selection change', source);
  }

  checkOneChange(source) {
    console.log('check one', source);
  }
}
